package com.laoxu.java.mybatisplus.controller;


import com.alibaba.fastjson.JSONObject;
import com.laoxu.java.mybatisplus.entity.User;
import com.laoxu.java.mybatisplus.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author laoxu
 * @since 2020-11-01
 */
@RestController
@RequestMapping("/api/user")
public class UserController {
    @Autowired
    UserService userService;


    @GetMapping("list")
    public String list(){
        List<User> users = userService.list(null);


        return JSONObject.toJSONString(users);
    }
}

